﻿#pragma once
#include <cstdint>
#include <vector>
#include "portaudio.h"
#include "pa_win_wasapi.h"

namespace util::audio {
    class AudioStreamReceiver {
    public:
        virtual ~AudioStreamReceiver() = default;
        virtual void Prepare(double sampleRate, double recordStep) = 0;
        virtual void Process(const std::vector<int16_t>& data) = 0;
        virtual void Finish() = 0;
    };

    class AudioRmsReceiver {
    public:
        virtual ~AudioRmsReceiver() = default;
        virtual void OnReceiveRMS(int tag, double time, double rms) = 0;
    };

    PaDeviceIndex GetLoopBackDevice4DefaultOutput();
    bool IsAudioRecording();
    bool StopAudioRecording();
    bool StartAudioRecording(AudioRmsReceiver* recv = nullptr);
}